package com.miao.im.support.mq;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.amqp.rabbit.connection.CorrelationData;

import java.util.Objects;

/**
 * @Auther: miaoguoxin
 * @Date: 2021/3/11 15:50
 * @Description:
 */
@Data
public class MqMessagePayload extends CorrelationData {
    //消息体
    private volatile Object message;
    //交换机
    private String exchange;
    //路由键
    private String routingKey;
    //重试次数
    private int retryCount = 0;

    public MqMessagePayload(String id) {
        super(id);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        MqMessagePayload payload = (MqMessagePayload) o;
        return super.getId().equals(payload.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.getId());
    }
}
